﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:memoria_2_Converter="clr-namespace:OnlineVideos.Game;assembly=OnlineVideos.Game"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
     xmlns:memoria_2_Helper="clr-namespace:OnlineVideos.Game;assembly=OnlineVideos.Game" 
    xmlns:System="clr-namespace:System;assembly=mscorlib"    
    mc:Ignorable="d">	
	<ControlTemplate x:Key="ValidationToolTipTemplate">
		<Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
			<Grid.RenderTransform>
				<TranslateTransform x:Name="xform" X="-25"/>
			</Grid.RenderTransform>
			<VisualStateManager.VisualStateGroups>
				<VisualStateGroup x:Name="OpenStates">
					<VisualStateGroup.Transitions>
						<VisualTransition GeneratedDuration="0"/>
						<VisualTransition GeneratedDuration="0:0:0.2" To="Open">
							<Storyboard>
								<DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
									<DoubleAnimation.EasingFunction>
										<BackEase Amplitude=".3" EasingMode="EaseOut"/>
									</DoubleAnimation.EasingFunction>
								</DoubleAnimation>
								<DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
							</Storyboard>
						</VisualTransition>
					</VisualStateGroup.Transitions>
					<VisualState x:Name="Closed">
						<Storyboard>
							<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
						</Storyboard>
					</VisualState>
					<VisualState x:Name="Open">
						<Storyboard>
							<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
							<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
						</Storyboard>
					</VisualState>
				</VisualStateGroup>
			</VisualStateManager.VisualStateGroups>
			<Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
			<Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
			<Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
			<Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
			<Border Background="#FFDC000C" CornerRadius="2"/>
			<Border CornerRadius="2">
				<TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
			</Border>
		</Grid>
	</ControlTemplate>
	<Style x:Key="MemoryRadioButtonStyle" TargetType="RadioButton">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="RadioButton">
					<Grid Background="#00000000">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CheckStates">
								<VisualStateGroup.Transitions>
									<VisualTransition From="Unchecked" GeneratedDuration="0:0:0.2" To="Checked">
										<VisualTransition.GeneratedEasingFunction>
											<ElasticEase EasingMode="EaseOut"/>
										</VisualTransition.GeneratedEasingFunction>
									</VisualTransition>
									<VisualTransition From="Checked" GeneratedDuration="0:0:0.2" To="Unchecked">
										<VisualTransition.GeneratedEasingFunction>
											<ElasticEase EasingMode="EaseOut"/>
										</VisualTransition.GeneratedEasingFunction>
									</VisualTransition>
								</VisualStateGroup.Transitions>
								<VisualState x:Name="Checked">
									<Storyboard>
										<DoubleAnimation Duration="0" To="0.8" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Unchecked">
									<Storyboard>
										<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Indeterminate"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Rectangle x:Name="rectangle" Margin="-4" RadiusY="10" RadiusX="10" Stroke="#FFF9F5F5" StrokeThickness="2" Width="108" Height="42"/>
						<Rectangle Fill="White" Opacity="0.48" RadiusY="10" RadiusX="10" Width="100" Height="34"/>
						<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="MemoryButtonStyle" TargetType="Button">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="Button">
					<Grid>
						<Rectangle Fill="#FFFFFFFF" Opacity="0.48" RadiusY="10" RadiusX="10"/>
						<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="MemoryListBoxStyle" TargetType="ListBox">
		<Setter Property="Padding" Value="1"/>
		<Setter Property="Background" Value="#FFFFFFFF"/>
		<Setter Property="Foreground" Value="#FF000000"/>
		<Setter Property="HorizontalContentAlignment" Value="Left"/>
		<Setter Property="VerticalContentAlignment" Value="Top"/>
		<Setter Property="IsTabStop" Value="False"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="TabNavigation" Value="Once"/>
		<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
		<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
		<Setter Property="BorderBrush">
			<Setter.Value>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FFA3AEB9" Offset="0"/>
					<GradientStop Color="#FF8399A9" Offset="0.375"/>
					<GradientStop Color="#FF718597" Offset="0.375"/>
					<GradientStop Color="#FF617584" Offset="1"/>
				</LinearGradientBrush>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListBox">
					<ItemsPresenter Margin="0" d:LayoutOverrides="Width, Height"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="CardListBoxItemStyle" TargetType="ListBoxItem">
		<Setter Property="Padding" Value="3"/>
		<Setter Property="HorizontalContentAlignment" Value="Left"/>
		<Setter Property="VerticalContentAlignment" Value="Top"/>
		<Setter Property="Background" Value="Transparent"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="TabNavigation" Value="Local"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListBoxItem">
					<Grid Background="{TemplateBinding Background}">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal"/>
								<VisualState x:Name="MouseOver"/>
								<VisualState x:Name="Disabled">
									<Storyboard>
										<DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="SelectionStates">
								<VisualState x:Name="Unselected"/>
								<VisualState x:Name="Selected"/>
								<VisualState x:Name="SelectedUnfocused"/>
							</VisualStateGroup>
							<VisualStateGroup x:Name="FocusStates">
								<VisualState x:Name="Focused"/>
								<VisualState x:Name="Unfocused"/>
							</VisualStateGroup>
							<VisualStateGroup x:Name="LayoutStates">
								<VisualState x:Name="AfterLoaded"/>
								<VisualState x:Name="BeforeLoaded"/>
								<VisualState x:Name="BeforeUnloaded"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<!-- Resource dictionary entries should be defined here. -->
	<Style x:Key="CardToggleButtonStyle" TargetType="ToggleButton" >
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ToggleButton">
                    <Grid x:Name="grid" Cursor="Hand"  Background="#00000000">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CheckStates">
								<VisualStateGroup.Transitions>
									<VisualTransition From="Unchecked" GeneratedDuration="0:0:0.2" To="Checked">
										<VisualTransition.GeneratedEasingFunction>
											<ElasticEase EasingMode="EaseOut"/>
										</VisualTransition.GeneratedEasingFunction>
										<Storyboard>
											<DoubleAnimation Duration="0:0:0.2" To="-90" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgBack" d:IsOptimized="True"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgBack">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.2">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgFore">
												<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="90"/>
												<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
											</DoubleAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgFore">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.2">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualTransition>
									<VisualTransition From="Checked" GeneratedDuration="0:0:0.4" To="Unchecked">
										<VisualTransition.GeneratedEasingFunction>
											<ElasticEase EasingMode="EaseOut"/>
										</VisualTransition.GeneratedEasingFunction>
										<Storyboard>
											<DoubleAnimation Duration="0:0:0.2" To="90" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgFore" d:IsOptimized="True"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgFore">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.2">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgBack">
												<DiscreteObjectKeyFrame KeyTime="0:0:0.2">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgBack">
												<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-90"/>
												<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
											</DoubleAnimationUsingKeyFrames>												
										</Storyboard>
									</VisualTransition>
								</VisualStateGroup.Transitions>
								<VisualState x:Name="Checked">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgBack">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="grid">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<System:Boolean>False</System:Boolean>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Unchecked">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imgFore">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Indeterminate"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
                        <Image x:Name="imgFore" Source="{Binding Image}" Height="{Binding gameheight}" Width="{Binding gamewidth}" Stretch="Fill" >
							<Image.Projection>
								<PlaneProjection/>
							</Image.Projection>
						</Image>
                        <Canvas >
                            <Canvas.Resources>
                                
                               <BeginStoryboard x:Name="new" >
                                    <Storyboard x:Name="EaseSB">
                                                                                 
                                        
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationZ)" RepeatBehavior="Forever" Storyboard.TargetName="imgBack">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="{Binding storyboardfromz}"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:0.2" Value="{Binding storyboardtoz}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" RepeatBehavior="Forever" Storyboard.TargetName="imgBack">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="{Binding storyboardfromy}"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:0.2" Value="{Binding storyboardtoy}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" RepeatBehavior="Forever" Storyboard.TargetName="imgBack">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="{Binding storyboardfromx}"/>
                                            <EasingDoubleKeyFrame KeyTime="00:00:0.2" Value="{Binding storyboardtox}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                         
                                       
                                    </Storyboard>
                                </BeginStoryboard>
                            </Canvas.Resources>
                            <Image x:Name="imgBack"  Source="{Binding backimage}" Height="{Binding gameheight}" Width="{Binding gamewidth}">
                                <Image.Projection>
                                    <PlaneProjection/>
                                </Image.Projection>
                            </Image>
                                
                        </Canvas>
                       
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>	
	
	<DataTemplate x:Key="MemoryCardDataTemplate">
        <Grid  Width="{Binding Main.CardSize, Source={StaticResource Locator}}" Height="{Binding Main.CardSize, Source={StaticResource Locator}}" Background="#00000000" Margin="{Binding gamethick}">
           
			<ToggleButton HorizontalAlignment="Left" ClickMode="Press"  Style="{StaticResource CardToggleButtonStyle}" VerticalAlignment="Top" IsChecked="{Binding Upside, Mode=TwoWay}" Visibility="{Binding Solved}" Padding="8">
				<i:Interaction.Triggers>
                    <i:EventTrigger EventName="Checked">
						<memoria_2_Helper:CallDatacontextMethodAction MethodName="OnSelectionChanged"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</ToggleButton>
		</Grid>
	</DataTemplate>
 <FontFamily x:Key="GameFont">/Fonts/HEADOH_.TTF#Headline One</FontFamily>
</ResourceDictionary>